TickerManagement [C#]

This example shows how to retrive groups and tickers from specific manager, and how to change the 'publish' status to 'unpublish'.

[C#]
    
   //Initialize the XAML object and retrieve group from server by login 
   public TickerManagement(string login, string password) 
   { 
       InitializeComponent(); 
  
       //Login and retrive group 
       List<View_Group> listResult; 
       sample.GetGroup(out listResult, login, password); 
  
       //Bind group to TreeList 
       treeGroup.ItemsSource = TreeNode.GetTreeNode(listResult); 
   } 


 

[C#]
    
   //Select group and retrive coresponding ticker 
   private void treeGroup_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) 
   { 
       //Retrive tickers from selected group 
       List<View_Banner> listResult; 
       sample.GetTicker(out listResult, (treeGroup.SelectedItem as TreeNode).Id ?? 0); 
  
       //Bind ticker to List 
       gridTicker.ItemsSource = new ObservableCollection<View_Banner>(listResult); 
   } 


 

[C#]
    
   //Select ticker and display this status 
   private void gridTicker_SelectionChanged(object sender, SelectionChangedEventArgs e) 
   { 
       if (gridTicker.SelectedItem == null) return; 
  
       //Display if the ticker as 'Published' or 'Unpublished' 
       btnPublish.Content = (gridTicker.SelectedItem as View_Banner).FolderId == -1 ? "Unpublished" : "Published"; 
   } 


 

[C#]
    
   //Published / Unpublished a tcker 
   private void btnPublish_Click(object sender, RoutedEventArgs e) 
   { 
       //Keep the ticker to publish 
       View_Banner ticker = gridTicker.SelectedItem as View_Banner; 
  
       //Change this folder id 
       ticker.FolderId = ticker.FolderId == -1 ? -2 : -1; 
  
       //Update the ticker 
       sample.UpdateTicker(ref ticker); 
  
       //Refresh the ticker collection 
       gridTicker_SelectionChanged(null, null); 
   }